home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 July
/
Macworld (1999-07).dmg
/
Serious Software
/
OpenWorld demo 2.0
/
Development
/
DoubleTag
/
Upcase
/
UPCASE.c
next >
Wrap
Text File
|
1999-04-21
|
1KB
|
56 lines
/* File: Upcase.c
Copyright (c) 1999 Marco Bambini. All rights reserved.
Description: transform to uppercase the text between the <UPCASE> </UPCASE> tags
*/
#include "OpenWorld_plugIn.h"
#include <CodeFragments.h>
Boolean main (dataPtr param)
{
switch (param->message)
{
case init_message:
{
param->version=kVersion;
param->customData=kUnused;
}
break;
case run_message:
{
long l=0,i=0;
if (param->dim==0) return NULL;
if (param->inputText==NULL) return NULL;
// the lenght of the text
l=param->dim;
// allocate space for the return buffer
param->outputText=(char *)OW_NewPtr(param,l);
if (param->outputText==NULL) {param->dim=0;return NULL;}
// perform the operation
while (param->inputText[i])
{param->outputText[i]=(char)toupper(param->inputText[i]);i++;}
}
break;
case stop_message:
{
// dispose the buffer
OW_DisposePtr(param,param->outputText);
}
break;
case end_message:
{
// do nothing
}
break;
}
// Ask OpenWorld to send the text between <UPCASE> and </UPCASE> in the run_message
return kDoubleTag;
}